package com.dizang.view.entity;

import java.util.Scanner;

public class Child {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.print("请输入一个字符串，并按回车执行：");
		String s1 = scanner.next();
		System.out.println("s1=" + s1);
		String s2 = copy(s1);
		System.out.println("s2=" + s2);
	}

	public static String copy(String s) {
		if (s == null || s.trim().isEmpty())
			return null;
		char[] a = s.toCharArray(); // 任意字符数组
		char[] b = new char[a.length];
		for (int i = 0; i < a.length; i++) {
			b[i] = a[i];
		}
		return new String(b);
	}

}
